package lab03.test13;
import javax.xml.transform.Result;
import java.sql.*;

public class Test {
    public static void main(String[] args) {

        //加载驱动程序
        Connection  connection=null;
        Statement   statement=null;
        Result result=null;

        //表名字：t_users
        String sql="insert into t_users(id,username,password) values(1,'chen','123')";
        try {
            Class.forName("com.mysql.jdbc.Driver");
            connection= DriverManager.getConnection(
                    "Jdbc:mysql://localhost:3306/sctu?serverTimezone=UTC",
                    "root",
                    "123456"
            );
            statement=connection.createStatement();

            statement.execute(sql);
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (SQLException e) {
            e.printStackTrace();
        }finally {
            try {
                statement.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
            try {
                connection.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }

    }
}